// Copyright (c)  MOKEYISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using NSQL.Generator;

namespace NSQL.Statements
{
    /// <summary>
    /// The MINUS command operates on two SQL statements. It takes all the results from the first SQL statement,
    /// and then subtract out the ones that are present in the second SQL statement to get the final result set.
    /// If the second SQL statement includes results not present in the first SQL statement,
    /// such results are ignored.
    /// </summary>
    /// <remarks>
    /// <para>1. Each SELECT statement within UNION must have the same number of columns</para>
    /// <para>2. The columns must also have similar data types</para>
    /// <para>3. The columns in each SELECT statement must also be in the same order</para>
    /// </remarks>
    public class MinusStatement : IDataSetStatement
    {
        public IDataSetStatement Left { get; set; }
        public IDataSetStatement Right { get; set; }

        public MinusStatement(IDataSetStatement left, IDataSetStatement right)
        {
            Left = left ?? throw new ArgumentNullException(nameof(left));
            Right = right ?? throw new ArgumentNullException(nameof(right));
        }
        public string Accept(ISqlGenerator generator) => generator.Generate(this);
        public object Tag { get; set; }
    }
}